package com.googlecode.everyidea.core.dao;

import com.googlecode.everyidea.core.model.User;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class UserDAOImpl extends SqlMapClientDaoSupport implements UserDAO {

    /**
     * 
     * This method corresponds to the database table S_USER
     *
     * 
     */
    public UserDAOImpl() {
        super();
    }

    /**
     * 
     * This method corresponds to the database table S_USER
     *
     * 
     */
    public void insert(User record) {
        getSqlMapClientTemplate().insert("S_USER.insert", record);
    }

    /**
     * 
     * This method corresponds to the database table S_USER
     *
     * 
     */
    public int updateByPrimaryKey(User record) {
        int rows = getSqlMapClientTemplate().update("S_USER.updateByPrimaryKey", record);
        return rows;
    }

    /**
     * 
     * This method corresponds to the database table S_USER
     *
     * 
     */
    public int updateByPrimaryKeySelective(User record) {
        int rows = getSqlMapClientTemplate().update("S_USER.updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * 
     * This method corresponds to the database table S_USER
     *
     * 
     */
    public User selectByPrimaryKey(String userId) {
        User key = new User();
        key.setUserId(userId);
        User record = (User) getSqlMapClientTemplate().queryForObject("S_USER.selectByPrimaryKey", key);
        return record;
    }

    /**
     * 
     * This method corresponds to the database table S_USER
     *
     * 
     */
    public int deleteByPrimaryKey(String userId) {
        User key = new User();
        key.setUserId(userId);
        int rows = getSqlMapClientTemplate().delete("S_USER.deleteByPrimaryKey", key);
        return rows;
    }
}